<?php

use App\Http\Controllers\AdminController;
use App\Http\Controllers\AppointmentController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\WeddingDressController;
use App\Models\Appointment;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {return view('login');});
Route::post('/admin/login',[AdminController::class,'login']);

// 需要管理员认证才能操作的界面
Route::middleware('auth.admin')->prefix('admin')->controller(AdminController::class)->group(function(){
    Route::get('home','home');
    Route::get('weddingdress','weddingdress');
    Route::get('rend','rend');
    Route::get('user','user');
    Route::get('loginout','loginout');
});

Route::middleware('auth.admin')->prefix('wedding')->controller(WeddingDressController::class)->group(function(){
    Route::post('update','update');
    Route::post('save','save');
    Route::post('remove','remove');
    Route::post('add','add');
    Route::post('search','search');
});

Route::middleware('auth.admin')->prefix('appoinment')->controller(AppointmentController::class)->group(function(){
    Route::post('update','update');
    Route::post('save','save');
    Route::post('remove','remove');
    Route::post('search','search');
});

Route::middleware('auth.admin')->prefix('user')->controller(UserController::class)->group(function(){
    Route::post('update','update');
    Route::post('save','save');
    Route::post('remove','remove');
    Route::post('search','search');
});